<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCarStatisticsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('car_statistics', function (Blueprint $table) {
            $table->id();
            $table->integer('car_id')->default(0)->comment('车辆id');
            $table->string('series_name')->default('')->comment('车系名称');
            $table->integer('lease_times')->default(0)->comment('租车次数');
            $table->integer('lease_days')->default(0)->comment('租车天数');
            $table->decimal('total_amount',10,2)->default(0.00)->comment('总收入');
            $table->decimal('total_expend_amount',10,2)->default(0.00)->comment('总支出');
            $table->decimal('total_service',10,2)->default(0.00)->comment('总保养');
            $table->decimal('total_insure',10,2)->default(0.00)->comment('总保险');
            $table->decimal('total_maintenance',10,2)->default(0.00)->comment('总维修费用');
            $table->decimal('total_lease_amount',10,2)->default(0.00)->comment('总租金收入');
            $table->decimal('total_accident_amount',10,2)->default(0.00)->comment('事故支出');
            $table->decimal('residual_income',10,2)->default(0.00)->comment('残值收入');
            $table->timestamps();
        });
        \DB::statement("ALTER TABLE `car_statistics` comment '车辆统计'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('car_statistics');
    }
}
